package com.ruoyi.web.controller.oto;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 后台-部门控制器
 */
@RestController
@RequestMapping("/adm/branch")
public class BranchController extends BaseController{

    @Autowired
    private ISysDeptService sysDeptService;

    /**
     * 查询系统中所有的部门
     * @return
     */
    @RequestMapping("listbranch")
    AjaxResult<List<SysDept>> listAllBranch(){
        SysDept sysDept = new SysDept();
        sysDept.setParentId(101L);
        List<SysDept> list = sysDeptService.toBizDeptList(sysDeptService.selectDeptList(sysDept));
        return AjaxResult.success(list);
    }
}
